<template>
  <view class="my-search-container" :style="{'backgroundColor':bgcolor}">
    <view class="my-search" :style="{'border-radius':radius+'px'}" @click="searchBoxHandler()">
    <uni-icons type="search" size="17"></uni-icons>
      <text>搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name: "my-search",
    data() {
      return {

      };
    },
    props:{
      //  背景颜色
      bgcolor:{
        type:String,
        default:'#c00000'
      },
      radius:{
        type:Number,
        // 单位px
        default:20
      }
    },
    methods: {
      searchBoxHandler() {
        // 触发外界通过click绑定的时间处理函数
        this.$emit('click')
      }
    },
  }
</script>

<style lang="scss">
  .my-search-container {
    display: flex;
    // background-color: #c00000;
    height: 50px;
    align-items: center;
    padding:0 10px;
    
    .my-search {
      display: flex;
      height: 36px;
      background-color: #fff;
      // border-radius: 20px;
      align-items: center;
      width: 100%;
      justify-content: center; //  子类居中
    }
  }
</style>